﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body>

<?php

include("inc/joomlaInt.php");

include("inc/inc_configuration.php");

if ($jUser==0)
{
	echo "Bitte zuerst einloggen!";
}
else
{
	$matchId=$_GET["matchId"];

	//bisherige Forderungen

	$q = "SELECT 
			f.id AS fId,
			u.username AS username,
			f.date AS datetime,
			f.content AS content		
		FROM 
			$tbl_forderungen f,
			$tbl_users u
		WHERE 
			f.matchId=$matchId AND
			f.userId=u.id
		ORDER BY 
			datetime ASC";

	$qe=mysql_query($q);

	$c=mysql_num_rows($qe);

	if ($c==0)
	{
		echo "Bisher keine Forderungen vorhanden.";
	}

	if ($c>0)
	{
		echo "<h1>Forderungen</h1>";
		
		$i=0;
		
		while ($row=mysql_fetch_object($qe))
		{
			$id=$row->fId;
			$uN=$row->username;
			$datetime=$row->datetime;
			$content=$row->content;
			
			$zeit = date("d.m.Y - H:i",$datetime);
			
			if ($i>0)
			{
				echo"<br><br>";
			}
			
			echo "<b>$uN</b> schrieb ($zeit): <br><br> $content";
			
			$i++;
			
			
		}
		
		
		
	}


	echo "<h1>Forderung senden</h1>";

	echo '	<form action="fordern.php" method="post">
				<p>Geben Sie hier ihren Forderungstext ein:<br>
					<textarea name="content" cols="50" rows="10" wrap="soft"></textarea>
				</p>
				<input hidden type="text" size="17" name="matchId" value="',$matchId,'">
				<input hidden type="text" size="17" name="userId" value="',$jUser,'">
				
				<input type="submit" value="Senden" class="button eintragen">
			</form>';

	echo "<br><br>
				<center><a href='meine_spiele.php' class='button zurueck'>Zurück</a></center>";
}
?>

</body>
</html>